package com.mfangsoft.zhuangjialong.integration.xiaochengxuneeds.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mfangsoft.zhuangjialong.common.model.Page;
import com.mfangsoft.zhuangjialong.common.model.ResponseMessage;
import com.mfangsoft.zhuangjialong.common.utils.SysConstant;
import com.mfangsoft.zhuangjialong.integration.xiaochengxuneeds.model.BaseXiaoChengXuNeedsEntity;
import com.mfangsoft.zhuangjialong.integration.xiaochengxuneeds.service.XiaoChengXuNeedsService;

@Controller("serviceXiaoChengXuNeedsController")
@RequestMapping(value="/service/xiaoChengXuNeeds")
public class XiaoChengXuNeedsController {
	
	@Autowired
	XiaoChengXuNeedsService chengXuNeedsServiceImpl;
	
	@RequestMapping(value="/getNeeds",method=RequestMethod.POST)
	@ResponseBody
	public Page<Map<String, Object>> getNeeds(@RequestBody Page<Map<String, Object>> page){
		return chengXuNeedsServiceImpl.select(page);
	}

	@RequestMapping(value="/modifyNeeds",method=RequestMethod.POST)
	@ResponseBody
	public ResponseMessage<String> modifyNeeds(@RequestBody BaseXiaoChengXuNeedsEntity baseXiaoChengXuNeedsEntity){
		ResponseMessage<String> message = new ResponseMessage<>();
		if(chengXuNeedsServiceImpl.modify(baseXiaoChengXuNeedsEntity)){
			message.setCode(SysConstant.SUCCESS_CODE);
			message.setMessage(SysConstant.SUCCESS_MSG);
		}else{
			message.setCode(SysConstant.FAILURE_CODE);
			message.setMessage(SysConstant.FAILURE_MSG);
		}
		return message;
	}
}
